home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
FNTPAK32.ZIP
/
BASIC.EXE
/
DEMO_LIN.BAS
< prev
next >
Wrap
BASIC Source File
|
1995-08-16
|
5KB
|
118 lines
'************************************************************ Demo_Lin.Bas
' Demo_Lin.Pas Copyright 1994, Rob W. Smetana
'
' Font Pak demo program which shows how to:
'
' 1. Use SetMaxLines (...) to switch to 12 - 100 lines on
' the screen -- in TEXT mode!
'
' 2. Load a Font Pak font (from 4 to 24 points) to finish the job.
'
' 3. Using a local sub-routine (PrintIt) as an interface to
' our assembler WriteChar routine.
'
' Requires:
' a. A callable Font Pak font (e.g., Tiny04.F06)
' b. Procedures in Video.Obj (SetmaxLines, WriteChar, etc.)
' c. Procedures in Fonts.Obj
'
'************************************************************ Demo_Lin.Bas
DEFINT A-Z
'$INCLUDE: 'Font_Pak.Inc' '... for Microsoft BASICS
'======================================================== PowerBASIC Users
''$INCLUDE "Font_Pak.Inc" '... PB users, UN-REM these ines
''$Link "Tiny04.OBJ" '... ALL users: A tiny callable font
''$Link "FontPakP.OBJ" '... SHAREWARE users only
''$Link "Fonts.OBJ" '... REGISTERED users only
''$Link "Video.OBJ"
'======================================================== PowerBASIC Users
DECLARE SUB TINY04 (BYVAL Block%) '... declare a "callable font"
COLOR 7, 0: CLS
CALL FPInitialize: CLS '... for shareware versions only
SELECT CASE GetMonitor
CASE 7, 8: MaxLines = 50 '... VGA
CASE 4: MaxLines = 43 '... EGA
CASE ELSE: PRINT "Sorry, an EGA or VGA monitor is required.": END
END SELECT
WIDTH , MaxLines '... assuming a SMALL font, set
' up for maximum # of lines
' But ALWAYS change screen-modes
' BEFORE calling SetMaxLines!
ThisLine$ = " This is line #: Press a key ..." ' fill the blanks later
FontHeight = 6 '...tiny04 is a 4-point font
' in 6x8 grid
Numlines = SETMAXLINES(BYVAL FontHeight)
CALL TINY04(BYVAL 100) '... re-map block 0 -- the default
COLOR 0, 7: LOCATE 1, 14
PRINT " Using font Tiny04, we can get"; Numlines; "lines on the screen! ";
FOR Row = 3 TO Numlines
MID$(ThisLine$, 18, 3) = LTRIM$(STR$(Row))
GOSUB PrintIt '...use a local interface to
NEXT ' WriteChar (see notes below)
d$ = INPUT$(1) '... pause
WIDTH , 25 '... restore some normalcy
'=== IF you have a VGA, this uses the default 8x14 to get 28 lines!!!
IF GetMonitor > 6 THEN
WIDTH , MaxLines
FontHeight = 14 '...the default 8x14
Numlines = SETMAXLINES(BYVAL FontHeight)
CALL rsLoadDefault(FontHeight, 100) '... re-map block 0 -- the default
COLOR 0, 7: LOCATE 1, 8
PRINT " On VGA monitors, we can get"; Numlines; "lines using the default 8x14 font! ";
FOR Row = 3 TO Numlines
MID$(ThisLine$, 18, 3) = LTRIM$(STR$(Row)) + " "
GOSUB PrintIt '...use a local interface to
NEXT ' WriteChar (see notes below)
d$ = INPUT$(1) '... pause
WIDTH , 25 '... restore some normalcy
END IF
END
'======================================================================
PrintIt:
'NOTE: This is a simple interface to our WriteChar assembler routine.
' If you plan to use WriteChar, I suggest you put these few lines
' in : : : SUB PrintIt (Row%, StartCol%, Colr%, ThisLine$)
' That way you'll be able to use WriteChar from any program.
'======================================================================
StartCol = 22 '...hard code 2 parameters here
Colr = 79 '...79 = white on red
FOR Char = 1 TO LEN(ThisLine$)
ASCIICode = ASC(MID$(ThisLine$, Char))
CALL WRITECHAR(Row, StartCol + Char, ASCIICode, Colr)
NEXT
'ALSO NOTE: We must print a character at a time -- passing the ASCII
' code of the character. If you have an assembler "quick print"
' routine that's optimized for BASIC, use IT! WriteChar is
' admittedly simple -- so we can use it in C, Pascal, and ALL
' BASICs without having to worry about how strings are passed!
RETURN